package demo.liu.one.configs.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * @author by Liujt
 * @Classname ReturnCallbackConfig
 * @Description 未到达队列回调，配置文件添加：spring.rabbitmq.publisher-returns=true
 * @Date 2021/6/23 9:49
 */
@Slf4j
@Component
public class ReturnCallbackConfig implements RabbitTemplate.ReturnCallback {
    @Override
    public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
        log.info("returnedMessage ===> replyCode={} ,replyText={} ,exchange={} ,routingKey={}", replyCode, replyText, exchange, routingKey);
    }
}